<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">
	
	<a4j:form id="feesToSuppliersQueryForm" styleClass="trn_form">
		
		<a4j:outputPanel id="msgContainer" ajaxRendered="true">
			<h:messages globalOnly="false" errorClass="msgError" styleClass="message" infoClass="msgInfo" />
		</a4j:outputPanel>
		<a4j:outputPanel id="feesToSuppliersQueryPanel" ajaxRendered="true">
				<div id="Form_Table">
					<div id="Form_Row">
						<div class="form_fields">
							<s:label for="feesToSuppliersQuerySupplier">Proveedor:</s:label>
							<h:selectOneMenu
								styleClass="input"
								converter="#{supplierConverter}"
								value="#{trnPurchase.feesToSupplierQueryData.supplierData}"
								id="feesToSuppliersQuerySupplier" >
								<a4j:support event="onchange" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateSelectField(
                    				fieldObject = this, 
                    				fieldMsgId = 'feesToSuppliersQuerySupplierMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione el proveedor')">
           						</rich:ajaxValidator>
								<s:selectItems 
									value="#{withinHolder.supplierList()}" 
									var="supp"
									label="#{convertAssist.getSupplierName(supp.id)}"
									noSelectionLabel="Proveedor">
								</s:selectItems>
								<s:convertEntity></s:convertEntity>
							</h:selectOneMenu>	
							<div id="feesToSuppliersQuerySupplierMsg" class="inactiveMsg"></div>
						</div>
					</div>
				</div>
				<s:decorate template="/layout/displayButton.xhtml" style="width:250px;">
					<a4j:commandButton value="Buscar" id="feesToSuppliersQuerySearchBtn"
						action="#{trnPurchase.retrieveFeesToSuppliersBySupplierId()}"
						reRender="feesToSuppliersQueryGridPanel, feesToSuppliersQueryGrid"
						styleClass="button" style="margin-top:0;"
						onclick="onRequestStart();"
						oncomplete="onRequestEnd('j_id1193:feesToSuppliersQueryForm', 2);"/>
					<rich:spacer width="20px" />
				</s:decorate>
		</a4j:outputPanel>
		<a4j:outputPanel id="feesToSuppliersQueryGridPanel">	
				<rich:datascroller align="center" for="feesToSuppliersQueryGrid"
						maxPages="15" page="#{trnPurchase.scrollerPage}"
						renderIfSinglePage="false" />			   			
				<div style="clear: both;" />
				<rich:panel styleClass="table_add" rendered="#{not empty trnPurchase.allFeesToSupplierQueryData}">
					<rich:dataTable id="feesToSuppliersQueryGrid"
						var="row" rows="10"
						value="#{trnPurchase.allFeesToSupplierQueryData}"
						rendered="#{not empty trnPurchase.allFeesToSupplierQueryData}"
						rowClasses="rvgRowOne,rvgRowTwo"
						style="align:center;">
						
						<rich:column>
							<f:facet name="header"><h:outputText value="Fecha Comprobante" /></f:facet>
							<h:outputText value="#{row.voucherDate}" />
						</rich:column>
						<rich:column>
							<f:facet name="header"><h:outputText value="Nro. Comprobante" /></f:facet>
							<h:outputText value="#{comAssist.getInvoiceNumber(row.establishment, row.expedition, row.voucher, row.instalments)}" />
						</rich:column>
						<rich:column>
							<f:facet name="header"><h:outputText value="Saldo" /></f:facet>
							<h:outputText value="#{row.residuePaymentOrden}" />
						</rich:column>
					</rich:dataTable>
				</rich:panel>
		</a4j:outputPanel>
	</a4j:form>
	
</ui:composition>